<?php
  session_start();
  function utf8Substr($str, $from, $len)
{
return preg_replace('#^(?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$from.'}'.
'((?:[\x00-\x7F]|[\xC0-\xFF][\x80-\xBF]+){0,'.$len.'}).*#s',
'$1',$str);
} 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>选择餐厅</title>
<link href="style/css.css" rel="stylesheet" type="text/css">
<script src="js/jquery-1.9.0.min.js" type="text/javascript"></script>
<script src="js/jquery.blockUI.js" type="text/javascript"></script>
<script type="text/javascript"> 
var wait=60;

function time(o) {
        if (wait == 0) {
            o.removeAttribute("disabled");           
            o.value="发送验证码";
            wait = 60;
            o.className="resend-a";
        } else {
         o.className="resend-a2";
            o.setAttribute("disabled", true);
            o.value="重新发送(" + wait + ")";
            wait--;
            setTimeout(function() {
                time(o)
            },
            1000)
        }
    }
function sendSMS() //点击提交留言ajax显示
{ 
  
  var zhanghao=$("#userzhanghao").val();

  $.ajax({ 
    type:'post', //传送的方式,get/post 
    url:'getUsername.php', //发送数据的地址 
    cache:'false', 
    data:'zhanghao='+zhanghao, 
    datatype:"text",
    success:function(data) 
    { 
      var hi=data.split(",");
      if(hi[0]=="success"){
        sendPhone=hi[1];
        $.ajax({ 
               type:'post', //传送的方式,get/post 
               url:'post_mt.php', //发送数据的地址 
               cache:'false', 
               data:'name='+hi[1], 
              success:function(data) 
                { 
              
                }
            })

      }else{

        alert("该账号不存在");
      }

    }
  });


  
/*   */

  time(document.getElementById("reSend"));
} 
function phoneCheck(){

var yanzhengma=$("#yanzhengma").val();
//
if(yanzhengma==""){
    alert("请输入验证码!");
  }else{

    $.ajax({ 
    type:'post', //传送的方式,get/post 
    url:'phonecheckAjax.php', //发送数据的地址 
    cache:'true',  
    data:'phonecheck='+yanzhengma,
    datatype:"text",
    success:function(data) 
    { 
      
     if(data=="yes"){
      
       $.ajax({ 
    type:'post', //传送的方式,get/post 
    url:'sendupdatePass.php', //发送数据的地址 
    cache:'true',  
    data:'phonecheck=2',
    datatype:"text",
    success:function(data) 
    { 
      var hi=data.split(",");
      if(hi[0]=="yes"){

    $.ajax({ 
               type:'post', //传送的方式,get/post 
               url:'post_mt1.php', //发送数据的地址 
               cache:'false', 
               data:'name='+sendPhone+"&sendValue="+"您的重置密码为:"+hi[1],  
              success:function(data) 
                { 
      
                }
            });


        alert("成功重置，密码会以短信形式发送给您");


      }else if(hi[1]=="no"){
        alert("重置密码失败");
      }

    } 
  }); 





     
     }else if(data=="no"){
     alert("验证码错误");

     }else{
      alert("验证码错误");
     }
    } 
  }); 

  }


//



}


function forgetPass(){
   //给box_btn绑定一个鼠标点击的事件
  $.blockUI({    //当点击事件发生时调用弹出层
    message: $('#loginbox3'),    //要弹出的元素box
    css: {    //弹出元素的CSS属性
      border:'5px solid #334343',
      textAlign: 'left',
    width: '490px',
    top:  ($(window).height() - 290) /2 + 'px', 
      left: ($(window).width() - 490) /2 + 'px', 
    cursor: 'auto'
         },
    overlayCSS: {
    opacity: '0.7' 
              }
   });
  $('.blockOverlay').attr('title','单击关闭').click($.unblockUI);   //遮罩层属性的设置以及当鼠标单击遮罩层可以关闭弹出层
  $('.close').click($.unblockUI);  //也可以自定义一个关闭按钮来关闭弹出层
 

  




}

function showHot(showfou)
{
if(showfou==1){
  $("li[sign*='coldsupplier']").css("display","none");
$("#checkboxtuijian").attr("onclick","showHot(0)");
}else if(showfou==0){

  $("li[sign*='coldsupplier']").css("display","inline");
$("#checkboxtuijian").attr("onclick","showHot(1)");

}


}
function InputCheck(LoginForm)
{
  if (LoginForm.username.value == "")
  {
    alert("请输入用户名!");
    LoginForm.username.focus();
    return (false);
  }
  if (LoginForm.password.value == "")
  {
    alert("请输入密码!");
    LoginForm.password.focus();
    return (false);
  }
}

function showOpen(showfou){
if(showfou==1){
$("li[signtime*='isclosing']").css("display","none");
$("#checkboxyingye").attr("onclick","showOpen(0)");
}else if(showfou==0){

  $("li[signtime*='isclosing']").css("display","inline");
$("#checkboxyingye").attr("onclick","showOpen(1)");

}

}

$(function(){ 





//Default Action 
$(".tab_content").hide(); //Hide all content 
$("ul.tabs li:first").addClass("active").show(); //Activate first tab 
$(".tab_content:first").show(); //Show first tab content 
//On Click Event 
$("ul.tabs li").click(function() { 
$("ul.tabs li").removeClass("active"); //Remove any "active" class 
$(this).addClass("active"); //Add "active" class to selected tab 
$(".tab_content").hide(); //Hide all tab content 
var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content 
$(activeTab).fadeIn(); //Fade in the active content 
return false; 
}); 
}); 
</script> 
<script type="text/javascript"> 
$(function(){

  if(mimacheck==1){
       //给box_btn绑定一个鼠标点击的事件
  $.blockUI({    //当点击事件发生时调用弹出层
    message: $('#loginbox'),    //要弹出的元素box
    css: {    //弹出元素的CSS属性
      border:'5px solid #334343',
      textAlign: 'left',
    width: '490px',
    top:  ($(window).height() - 290) /2 + 'px', 
      left: ($(window).width() - 490) /2 + 'px', 
    cursor: 'auto'
         },
    overlayCSS: {
    opacity: '0.7' 
              }
   });
  $('.blockOverlay').attr('title','单击关闭').click($.unblockUI);   //遮罩层属性的设置以及当鼠标单击遮罩层可以关闭弹出层
  $('.close').click($.unblockUI);  //也可以自定义一个关闭按钮来关闭弹出层


  $("#passerrorShow").css("display","block");
  }
$('#login').click(function(){   //给box_btn绑定一个鼠标点击的事件
$.blockUI({    //当点击事件发生时调用弹出层
  message: $('#loginbox'),    //要弹出的元素box
  css: {    //弹出元素的CSS属性
    border:'5px solid #334343',
    textAlign: 'left',
  width: '490px',
  top:  ($(window).height() - 290) /2 + 'px', 
    left: ($(window).width() - 490) /2 + 'px', 
  cursor: 'auto'
       },
  overlayCSS: {
  opacity: '0.7' 
            }
         });
$('.blockOverlay').attr('title','单击关闭').click($.unblockUI);   //遮罩层属性的设置以及当鼠标单击遮罩层可以关闭弹出层
$('.close').click($.unblockUI);  //也可以自定义一个关闭按钮来关闭弹出层

});

});
function suppliername(thisName){

$("#suppliernamesubmit").val(thisName);
 document.formx1.submit();
}
</script> 
</head>

<body>
<div id="loginbox3" style="display:none">
  <div class="login_title">忘记密码</div>
  <div class="login_input">
    <div class="inputb"><span>账号：</span><span><input  name="username" id="userzhanghao" type="text" /></span></div>
    <div class="inputc"><span></span><span><input style="width:98px;height:22px;color: #336666;
    font-size: 12px;
    
    line-height: 32px;" id="reSend" value="发送验证码" onclick="sendSMS()" name="password" type="button" /></span></div>
     <div class="inputa"><span>验证码：</span><span><input style="width:98px;" id="yanzhengma" name="password" type="password" /></span></div>
    <div class="reg clearfix"><span><input class="" onclick="phoneCheck()" type="image" src="images/login.jpg" /></span></div>
  </div>

</div>
<form action="sub.php" method="post" name="formx1" style="display:none">
  <input type="hidden" name="suppliername"  id="suppliernamesubmit" value="" />


</form>
<div id="loginbox" style="display:none">
<form name="LoginForm" method="post" id="alllogin" action="login.php" onSubmit="return InputCheck(this)">
  <div class="login_title">会员登录</div>
  <div class="login_input">
    <div class="input"><span>账号：</span><span><input name="username" type="text" /></span></div>
    <div class="input"><span>密码：</span><span><input name="password" type="password" /></span></div>
    <input name="headeraction" type="hidden" value="sub" />
    <input name="subSubname" type="hidden" value="<?php echo $_REQUEST['suppliername'] ?>" />
    <div class="login_input_1 clearfix"><input name="" type="checkbox" value="" id="store1" /><label for="store1">自动登录</label><a onclick="forgetPass()" href="javascript:void(0)">找回密码</a><span style="color:red;display:none" id="passerrorShow" >&nbsp;&nbsp;账号或密码错误</span></div>
    <div class="reg clearfix"><span><input class="login_btn" name="submit" type="image" src="images/login.jpg" /></span><span>还没有账号？</span><a href="reg11.php">立即注册</a></div>
  </div>
</form>
</div>
<?php

if(isset($_SESSION['yesorno'])){
  echo '<input type="hidden" id="mimacheck" value="1" />';


 }else{

echo '<input type="hidden" id="mimacheck" value="0" />';

 } 

if(isset($_SESSION['yesorno1'])){
  echo '<input type="hidden" id="mimacheck1" value="1" />';


 }else{

echo '<input type="hidden" id="mimacheck1" value="0" />';

 } 
 ?>

<div class="top">
  <div class="top_content clearfix"><span class="left"><a href="index.php"><img src="images/wmwlogo.png"></a></span><span class="right">
 
  <?php
    if(isset($_SESSION['username'])){
      if($_SESSION['logintype']=="userlog"){
     echo '<a href="member.php">'.$_SESSION['username'],'欢迎你！</a>';
}elseif ($_SESSION['logintype']=="supplierlog") {
   echo '<a href="shop-xx.php">'.$_SESSION['username'],'欢迎你！</a>';
}
      echo '<a href="login.php?action=logout">登出</a>';
    }else{
      echo ' <a href="#" id="login">';
      echo '登录';
      echo '</a> / <a href="reg11.php">注册</a>';
    }
  ?>
  
</div>
<div class="content clearfix"> 
  <div class="sub_top clearfix">
    <div class="left"><span class="sub_top_addr"><?php echo $_REQUEST['suppliername'] ?></span><span>[<a href="index.php">切换地址]</a></span></div>
    <div class="right">
    <?php
include('system/db/conn.php');
      $sub_area_query4 = mysql_query("select * from do_area  order by clickCount desc limit 3");
            while($subrow4 = mysql_fetch_array($sub_area_query4)){

    ?>
    <span class="sub_top_nearby"><a href="javascript:suppliername('<?php echo $subrow4['name'] ?>')"><?php echo $subrow4['name'] ?></a></span>
    <?php
      }

    ?>

    </div>
  </div>
  <div class="content_con clearfix" style="margin-top:0px;">
    <div class="box">
      <div class="box_title"><div class="box_title_title">
        <input type="checkbox" name="checkbox" id="checkboxtuijian" onclick="showHot(1)" />
        <label for="checkbox">推荐餐厅</label>
        <input type="checkbox" name="checkbox" id="checkboxyingye" onclick="showOpen(1)" />
        <label for="checkbox1">营业中</label>
        
      </div></div>
      <div class="sub clearfix">
        <ul class="sub_con clearfix">
          <?php


$check_query8 = mysql_query("select * from do_area where name='".$_REQUEST['suppliername']."'");
if($result8 = mysql_fetch_array($check_query8)){
$dianjilv=0;
  
  if(!( $result8['clickCount']>=0)){
    $dianjilv=1;
  }else{
    $dianjilv=($result8['clickCount']+1);
  }
$sql5 = "update do_area set clickCount=$dianjilv where name='".$_REQUEST['suppliername']."'";
if(mysql_query($sql5,$conn)){
  


  }
  

}

        $sub_area_query = mysql_query("select t.*,b.supplier_id,b.stopbusiness,b.is_hot,b.open_time,b.preview as bpreview,b.is_drink,b.is_timelypay,b.is_discount from do_supplier t,do_supplier_location b where b.supplier_id=t.id  and locate('".$_REQUEST['suppliername']."' ,b.locate_match_row) >0
  order by t.sort  ");
        $jishu=0;
            while($subrow = mysql_fetch_array($sub_area_query)){ 
              $jishu+=1;


?>
<?php 
date_default_timezone_set("Asia/Shanghai");
$codt=time();
$nowshifen=date("1992-12-28 H:i:s",$codt);

$hello = explode('-',$subrow['open_time']);
  if($subrow['is_hot']==1)
{
  if("1992-12-28 ".$hello[0].":00"<$nowshifen&&"1992-12-28 ".$hello[1].":00">$nowshifen){
?>

   <li sign="hotsupplier" signtime="isopening" id="subS<?php echo $subrow['supplier_id'] ?>">
   
   <?php 
   }else{

    echo '<li sign="hotsupplier" signtime="isclosing" id="subS'. $subrow['supplier_id'].'">';
   }
 }else{
 if("1992-12-28 ".$hello[0].":00"<$nowshifen&&"1992-12-28 ".$hello[1].":00">$nowshifen){
    echo "<li sign='coldsupplier' signtime='isopening' id='subS".$subrow['supplier_id']."'>"; }else{

    echo '<li sign="coldsupplier" signtime="isclosing" id="subS'.$subrow['supplier_id'].'">';
   }

    }

$nextstring=$subrow["name"];
              $tmpstr = "";
              if(strlen($nextstring)>12){ 
        $hi=utf8Substr($nextstring,0,4);
      $nextstring=$hi."...";
}
    ?>
            <div class="clearfix">
              <div class="sub_logo left"><a href="sub1.php?supplierid=<?php echo $subrow['id'] ?>"><img src="<?php echo $subrow["bpreview"] ?>" width="42" height="42"></a></div>
              <div class="left"><span class="store"><a href="sub1.php?supplierid=<?php echo $subrow['id'] ?>"><?php echo $nextstring ?></a></span><span class="store_case">中式快餐</span></div>
            </div>


            <div class="sub_info"><div class="sub_time left"></div><div class="left">



 <?php
            if($subrow['is_drink']==1){
          
          ?>
<img src="images/sub1.gif">

          <?php
}

          ?>
          <?php
            if($subrow['is_timelypay']==1){
          
          ?>
<img src="images/sub2.gif">

          <?php
}

          ?>
           <?php
            if($subrow['is_discount']==1){
          
          ?>
<img src="images/sub3.gif">

          <?php
}

          ?>

            </div></div>
          

          </li>

<?php
            }
            if($jishu==0){
              ?>
              <div style="height:250px;diplay:block"></div>
              <?php
            }
              mysql_free_result($sub_area_query);
            
        
      ?>

       
        
 
        </ul>
        
      </div>
    </div>
  </div>
</div>


<?php include('bottom.php') ?> 
</body>
</html>
